//服务层
const mongoose = require("mongoose");
module.exports.getAll3 = async () => {
    return await mongoose.model("categoryModel").find()
}

module.exports.addOne3 = async (ctg) => {
    return await mongoose.model("categoryModel").create(ctg);
}
module.exports.deleteOne3 = async function(cateId) {
	const data = await mongoose.model("categoryModel").deleteOne(cateId);
	return data;
};
module.exports.getOne3 = async _id => {
	return await mongoose.model("categoryModel").find(_id);
};
module.exports.updateOne3 = async ({ _id, name,canuse}) => {
	return await mongoose
		.model("categoryModel")
		.updateOne({ _id }, { name ,canuse});
};
